#!/usr/bin/env python
# -*- coding: utf-8 -*-

# @Time    : 2021/3/9 22:34
# @Author  : Keyman
# @File    : R-2.6.py


class CreditCard:
    """A consumer credit card."""
    def __init__(self, customer: str, bank: str, account: str, limit: int):
        """
        Create a new credit card instance.
        The initial balance is zero.
        :param customer: the name of the customer (e.g. 'Keyman')
        :param bank: the name of the bank (e.g. 'Bank of China')
        :param account: the account identifier (e.g. '5391 0375 9387')
        :param limit: credit limit (measured in CNY)
        """
        self._customer = customer
        self._bank = bank
        self._account = account
        self._limit = limit
        self._balance = 0

    def ger_customer(self):
        """Return the name of customer."""
        return self._customer

    def get_bank(self):
        """Return the name of the bank."""
        return self._bank

    def get_account(self):
        """Return the card identifying number (typically stored as a string)."""
        return self._account

    def charge(self, price):
        """Charge given price to the card, assuming sufficient credit limit.
        Return True if charge was processed; False if charge was denied.
        """
        if price + self._balance > self._limit:
            return False
        else:
            self._balance += price
            return True

    def make_payment(self, amount):
        """Process customer payment that reduces balance."""
        if amount < 0:
            raise ValueError("The value must be positive")
        self._balance -= amount
